<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>购物车</title>
		<script src="/Public/Home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="/Public/Home/css/head.css"/>
		<link rel="stylesheet" type="text/css" href="/Public/Home/css/footer.css"/>
		<link rel="stylesheet" type="text/css" href="/Public/Home/css/go.css"/>
		<link rel="stylesheet" href="/Public/Home/goods/style/cart.css" type="text/css">
<script type="text/javascript" src="/Public/Home/goods/js/cart1.js"></script>
<link rel="stylesheet" href="/Public/Home/goods/style/base.css" type="text/css">
	<link rel="stylesheet" href="/Public/Home/goods/style/global.css" type="text/css">
	 <script type="text/javascript" src="/Public/Home/js/layer/layer.js" ></script>
      <script type="text/javascript" src="/Public/Home/js/layer/tanchu.js" ></script>

		<script>
// 判断登录状态 
$.ajax({
	type : "GET",
	url : "<?php echo U('Member/ajaxChkLogin'); ?>",
	dataType : "json",
	success : function(data)
	{
		if(data.login == 1)
			var li = '您好，'+data.username+' [<a href="<?php echo U('Member/logout'); ?>">退出</a>]';
		else
			var li = '您好，欢迎来到快乐购！[<a href="<?php echo U('Member/login'); ?>">登录</a>] [<a href="<?php echo U('Member/regist'); ?>">免费注册</a>]'
		$("#logInfo").html(li);
	}
});
</script>
	</head>
	<body>
		<div class="header">
			<div class="header_top">
				<div class="w1200">
					<div class="h_t_l">
						<div class="login_l">
						   <div id="logInfo"></div>
						</div>
					</div>
					<div class="h_t_r">
						<ul>
							<li>
								<a href="">订单查询</a>
								<span class="line"></span>
							</li>
							<li>
								<a href="">我的快乐购</a>
								<span class="line"></span>
							</li>
							<li>
								<i class="tel_icon"></i>
								<a href="">400-705-1111</a>
								<span class="line"></span>
							</li>
							<li>
								<a href="">下载快乐购app</a>
								<span class="line"></span>
							</li>
							<li>
								<a href="">客服中心</a>
							</li>
						</ul>
					</div>
				</div>
			</div>
			<!--图片-->
			<div class="full_sc order_bottom">
				<div class="w1200 header_conter ">
					<div class="h_c_logo">
	    			    <a href="index.html">
	    				    <img src="/Public/Home/image/logo.jpg"/>
	    			    </a>
	    		    </div>
	    		    <div class="h_c_right">
	    		    	<div class="order_Status"></div>
	    		    </div>
				</div>
			</div>
			<!--end-->
		</div>
		<!-- 主体部分 start -->
		<?php if(!empty($data)){?>
	<div class="mycart w990 mt10 bc">
		
		<table>
			<thead>
				<tr>
					<th class="col1">商品名称</th>
					<th class="col2">商品信息</th>
					<th class="col3">单价</th>
					<th class="col4">数量</th>	
					<th class="col5">小计</th>
					<th class="col6">操作</th>
				</tr>
			</thead>
			<tbody>
				<?php  $tp = 0; foreach ($data as $k => $v): ?>
				<tr>
					<td class="col1"><a href=""><?php showImage($v['mid_logo']); ?></a>  
					<strong><a href="<?php echo U('Index/goods?id='.$v['goods_id']); ?>"><?php echo $v['goods_name']; ?></a></strong></td>
					<td class="col2"> 
						<?php foreach ($v['gaData'] as $k1 => $v1): ?>
							<p><?php echo $v1['attr_name']; ?>：<?php echo $v1['attr_value']; ?></p>
						<?php endforeach; ?>
					</td>
					<td class="col3">￥<span><?php echo $v['price']; ?>元</span></td>
					<td class="col4"> 
						<a href="javascript:;" class="reduce_num" onclick="decc(<?php echo $v['goods_id']?>,'1')" ></a>
						<input type="text" name="amount" value="<?php echo $v['goods_number']; ?>" class="amount" />
						<a href="javascript:;" onclick="addd(<?php echo $v['goods_id']?>,'2')" class="add_num"></a>
					</td>
					<td class="col5">￥<span><?php $xj = $v['price'] * $v['goods_number'];$tp+=$xj;echo $xj; ?></span></td>
					<td class="col6" id="aa<?php echo $v['goods_id']?>"><a  href="javascript:;" onclick="dell(<?php echo $v['goods_id']?>,'3')" >删除</a></td>
				</tr>
				<?php endforeach; ?>
			</tbody>
			<tfoot>
				<tr>
					<td colspan="6">购物金额总计： <strong>￥ <span id="total"><?php echo $tp; ?></span></strong></td>
				</tr>
			</tfoot>
		</table>
		<div class="cart_btn w990 bc mt10">
			<a href="/" class="continue">继续购物</a>
			<a href="<?php echo U('Order/add'); ?>" class="checkout">结 算</a>
		</div>
	</div>
	<?php }else{?>
	<!-- 主体部分 end -->
		<!--tip-->

		<div class="public_b">
			<div class="w1200">
				<div class="car_no_goods">
					<img src="/Public/Home/image/car_no_goods.jpg"/>
					<div class="no_goods">
						<p class="no_goods_t">亲，您的购物车空空如也，快去抢购心仪商品吧~</p>
						<p><a href="/" class="no_goods_buy">立即购买</a></p>
					</div>
				</div>
				<!--为你推荐-->
				<div class="guesslike_div">
					<div class="remat">
						<div class="d_h2">
							<ul>
                                <li class="on">猜你喜欢</li>
                            </ul>
						</div>
						<div class="detail_l_con4">
							<div class="noguess">暂无商品向您推荐</div>
						</div>
					</div>
				</div>
				<!--为你推荐-->
			</div>
		</div>
		<?php }?>
		<!--tipend-->
		<!--底部公用-->
	    <div class="footer no-margin-top">
	    	<div class="footer_b w1200"><img src="/Public/Home/image/foot_img1.jpg"/></div>
	    	<div class="footer_help w1200">
	    		<div class="footer1_l">
	    			<dl class="helpDl">
	    				<dt><h5>使用帮助</h5></dt>
	    				<dd><a href="">税费收取规则 </a></dd>
	    				<dd><a href="">新手指南 </a></dd>
	    			    <dd><a href="">常见问题 </a></dd>
	    				<dd><a href="">用户协议 </a></dd>
	    			</dl>
	    			<dl class="helpDl">
	    				<dt><h5>会员服务</h5></dt>
	    				<dd><a href="">积分政策  </a></dd>
	    				<dd><a href="">会员权益  </a></dd>
	    			    <dd><a href="">会员等级  </a></dd>
	    			</dl>
	    			<dl class="helpDl">
	    				<dt><h5>支付方式</h5></dt>
	    				<dd><a href="">积分支付  </a></dd>
	    				<dd><a href="">货到付款  </a></dd>
	    			    <dd><a href="">在线支付  </a></dd>
	    				<dd><a href="">优惠券支付  </a></dd>
	    			</dl>
	    			<dl class="helpDl">
	    				<dt><h5>配送方式</h5></dt>
	    				<dd><a href="">包邮政策   </a></dd>
	    				<dd><a href="">费用说明   </a></dd>
	    			    <dd><a href="">配送说明   </a></dd>
	    			</dl>
	    			<dl class="helpDl">
	    				<dt><h5>售后服务</h5></dt>
	    				<dd><a href="">电子发票   </a></dd>
	    				<dd><a href="">售后咨询   </a></dd>
	    			    <dd><a href="">退货办理   </a></dd>
	    				<dd><a href="">退货政策   </a></dd>
	    			</dl>
	    		</div>
	    		<div class="footer1_r">
	    			<ul>
	    				<li>
	    					<h2>手机快乐购</h2>
	    					<img src="/Public/Home/image/footer_ewm_01.png"/>
	    					<p>下载移动客户端</p>
	    				</li>
	    				<li>
	    					<h2>快乐购微信</h2>
	    					<img src="/Public/Home/image/footer_ewm_02.png"/>
                            <p>快乐购官方微信</p>
	    				</li>
	    			</ul>
	    		</div>
	    	</div>
	        <div class="footer_nav">
	        	<div class="w720">
	        		<ul>
	        			<li>
	        				<a href="">关于快乐购 </a>
	        				<span class="line"></span>
	        			</li>
	        			<li>
	        				<a href="">投资者关系 </a>
	        				<span class="line"></span>
	        			</li>
	        			<li>
	        				<a href="">商家入驻  </a>
	        				<span class="line"></span>
	        			</li>
	        			<li>
	        				<a href="">联系我们 </a>
	        				<span class="line"></span>
	        			</li>
	        		</ul>
	        	</div>
	        </div>
	        <div class="footer_bottom">
	        	<div class="w1200">
	        		<p>
	        			<span class="font_arial">Copyright© 2006-2016 happigo. All Rights Reserved </span>
                                           免费服务热线: 400-705-1111 | 固话也可拨打: 800-705-1111
                        <span class="font_arial">E-Mail: service@happigo.com</span><br>
                                           湘ICP备12000157号 信息网络传播视听节目许可证号：1810530
	        		</p>
	        		<p class="footer_b">
	        			<a href="http://www.itrust.org.cn/home/index/itrust_certifi/wm/2782875193.html">
	        				<img src="/Public/Home/image/foot_img3.png"/>
	        			</a>
	        			<a href="https://search.szfw.org/cert/l/CX20150428007576007720">
	        				<img src="/Public/Home/image/foot_img4.png"/>
	        			</a>
	        		</p>
	        	</div>
	        </div>
	    </div>
	    <!--底部end-->
	</body>
	<script>
	function dell(id,sta){
		$.get('<?php echo U('Cart/ajaxCardel');?>',{'goods_id':id,'sta':sta},function(res){
				if (res.status==0) {
					tanchu.tiao(res.message,res.data);
				}else{
					var z='aa'+id;

					$("#"+z).parent().remove();
				}
		},"JSON")
	}
	function decc(id,sta){

		$.get('<?php echo U('Cart/ajaxCardel');?>',{'goods_id':id,'sta':sta},function(res){
				if (res.status==0) {
					tanchu.tiao(res.message,res.data);
				}
		},"JSON")
	}
	function addd(id,sta){
		$.get('<?php echo U('Cart/ajaxCardel');?>',{'goods_id':id,'sta':sta},function(res){
				if (res.status==0) {
					tanchu.tiao(res.message,res.data);
				}
		},"JSON")
	}
	</script>
</html>